package ${package.Controller?replace(".controller","")}.sys.dao;


import ${package.Entity}.SysRole;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author yiming
* @title: SysRoleDao
* @projectName property
* @description: TODO
* @date 2019/6/1118:07
*/
public interface SysRoleDao {
@Select("SELECT r.sys_role_id sys_role_id, name, create_time, description, status from  sys_user_n_sys_role ur left join sys_role r on ur.sys_role_id=r.sys_role_id WHERE ur.sys_user_id=${r'#{userId}'}")
@Results({
@Result(property = "sysMenus",column = "sys_role_id",many = @Many(select = "${package.Controller?replace(".controller","")}.sys.dao.SysMenuDao.getByRoleId"))
})
List<SysRole> getByUserId(String userId);
    }
